#ifndef _SEARCHENGINESERVER_H
#define _SEARCHENGINESERVER_H

#include "TcpServer.h"
#include "ThreadPool.h"

class SearchEngineServer {
public: 

    SearchEngineServer(size_t threadNum, size_t queSize, const string & ip, unsigned short port);

    ~SearchEngineServer();

    void start();

    void stop();

    void onNewConnection(const TcpConnectionPtr & con);

    void onMessage(const TcpConnectionPtr & con);

    void onClose(const TcpConnectionPtr & con);

    void setTimeCallback(ThreadPool *pool);
private: 
    ThreadPool _pool;
    TcpServer _server;
};

#endif //_ECHOSERVER_H
